<template>
  <div class="home">
    <!-- <div class="chart" ref="chart"></div> -->

    <el-button type="primary" loading>主要按钮</el-button>

    <el-empty description="描述文字"></el-empty>
  </div>
</template>

<script>
import * as echarts from "echarts";

export default {
  name: "Home",
  props: ["id"],
  components: {},

  mounted() {
    this.$http
      .post(
        "equipment/manage/onAndOffByEqpType",
        JSON.stringify({ beginTime: "2021-06-13", endTime: "2021-07-12" })
      )
      .then((result) => {
        console.log(result);

        chart.setOption({
          xAxis: {
            data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"],
          },
          series: [
            {
              name: "销量",
              type: "bar",
              data: [5, 20, 36, 10, 10, 20],
            },
          ],
        });
      })
      .catch((error) => {
        console.log(error);
      });

    const chart = echarts.init(this.$refs.chart);
    // 指定图表的配置项和数据
    var option = {
      title: {
        text: "设备在线统计",
      },
      tooltip: {},
      legend: {
        data: ["在线", "离线"],
      },
      xAxis: {
        data: [],
      },
      yAxis: {},
      series: [],
    };

    // 使用刚指定的配置项和数据显示图表。
    chart.setOption(option);
  },
};
</script>

<style scoped lang="scss">
.home,
.chart {
  width: 100%;
  height: 100%;
}
</style>
